<!DOCTYPE html>
<html>
<head th:include="_header_include::frag(~{::title},~{::style},~{})">
    <title>客户管理</title>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="css/element-ui.css">
    <link rel="stylesheet" href="css/base.css">
    <style>
        /*button a{color:#fff!important;}
        .el-checkbox { width: 100%; }*/
        .mainSearchBg .el-form-item__label{width: 87px;}
    </style>
</head>
<body>
<div id="myCustom" class="myCustom mainPadding" style="display: none;">
    <el-breadcrumb separator="/" class="elBreadcrumb marginB20">
        <el-breadcrumb-item>Home</el-breadcrumb-item>
        <el-breadcrumb-item>电销管理</el-breadcrumb-item>
        <el-breadcrumb-item>客户管理</el-breadcrumb-item>
    </el-breadcrumb>
    <el-row class="marginB20">
        <el-button type="primary" @click="dialogChooseList = true"><i class="el-icon-menu"></i>选择列</el-button>
        <shiro:hasPermission name="customerManager:allocation">
            <el-button type="success" @click="openassignrDig">分配资源</el-button>
        </shiro:hasPermission>
        <shiro:hasPermission name="customerManager:transferclue">
            <el-button type="warning" @click="opentransferForm">转移资源</el-button>
        </shiro:hasPermission>
        <shiro:hasPermission name="customerManager:distribute">
            <el-button type="danger" @click="openvicemanagerForm">副总分发</el-button>
        </shiro:hasPermission>
        <shiro:hasPermission name="customerManager:releaseClue">
            <el-button type="success" @click="releaseClue" :disabled="releaseBtnDisabled" >释放资源</el-button>
          </shiro:hasPermission>
     </el-row>
     <div class="mainSearchBg">
         <div class="mainSearchFormBox">
             <el-form :inline="true" class="demo-form-inline mainSearchForm" :model="form" ref="form">
                 <!--     <el-form-item label="全部资源:">
                         <el-select v-model="form.isTransfer" placeholder="全部资源" style="width: 100%;" clearable >
                             <el-option
                                 v-for="item in isTransfer"
                                 :key="item.value"
                                 :label="item.label"
                                 :value="item.value">
                             </el-option>
                         </el-select>
                     </el-form-item>  -->
                <!--  <el-form-item label="">
                     <el-select v-model="form.cluesta" placeholder="资源有效性" style="width: 100%;" clearable>
                         <el-option
                             v-for="item in clueStatus"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value">
                         </el-option>
                     </el-select>
                 </el-form-item> -->
                <el-form-item label="客户手机号:">
                    <el-input v-model="form.customerPhone" placeholder="客户手机号"></el-input>
                </el-form-item>
                <el-form-item label="客户姓名:">
                    <el-input v-model="form.customerName" placeholder="客户姓名"></el-input>
                </el-form-item>
                <el-form-item label="资源ID:">
                    <el-input v-model="form.clueId" placeholder="资源ID"  @keyup.native="number"></el-input>
                </el-form-item>
                <el-form-item label="创建时间:">
                    <el-date-picker
                        v-model="form.createTimeStart"
                        type="datetime"
                        placeholder="选择日期时间">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="—" class="widthauto">
                    <el-date-picker
                        v-model="form.createTimeEnd"
                        type="datetime"
                        placeholder="选择日期时间">
                    </el-date-picker>
                </el-form-item>
                <el-row v-show="isShow">
                    <el-form-item label="客户状态:">
                        <el-select v-model="form.cusStatus" placeholder="客户状态" clearable >
                            <el-option
                                v-for="item in cusStatusArr"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="客户级别:">
                        <el-select v-model="form.cusLevelList" placeholder="客户级别"  clearable multiple>
                            <el-option
                                v-for="item in cusLevelArr"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <!-- <el-form-item label="">
                        <el-select v-model="form.hasInvite" placeholder="是否邀约" style="width: 100%;" clearable >
                            <el-option
                                v-for="item in hasInvite"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item> -->
                    <el-form-item label="今日是否拨打:">
                        <el-select v-model="form.dayTel" placeholder="今日是否拨打" style="width: 100%;" clearable>
                            <el-option
                                v-for="item in callTel"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="编辑时间:">
                        <el-date-picker
                            v-model="form.updateTimeStart"
                            type="datetime"
                            placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="—" class="widthauto">
                        <el-date-picker
                            v-model="form.updateTimeEnd"
                            type="datetime"
                            placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="今日是否跟访:">
                        <el-select v-model="form.trackingDay" placeholder="今日是否跟访" clearable>
                            <el-option
                                v-for="item in hastracking"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否重复手机:">
                        <el-select v-model="form.repeatStatus" placeholder="是否重复手机号" clearable >
                            <el-option
                                v-for="item in clueRepeatStatus"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="预签约省份:">
                        <el-select v-model="form.province" placeholder="预签约省份" clearable   filterable  multiple>
                            <el-option
                                v-for="item in provinceArr"
                                :key="item.name"
                                :label="item.name"
                                :value="item.name">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="分配时间:">
                        <el-date-picker
                            style="width: 100%;"
                            v-model="form.assignTimeStart"
                            type="datetime"
                            placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="—" class="widthauto">
                        <el-date-picker
                            style="width: 100%;"
                            v-model="form.assignTimeEnd"
                            type="datetime"
                            placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>

                    <el-form-item label="电销组:">
                        <el-select v-model="form.teleorg" placeholder="电销组" style="width: 100%;" clearable @change="currentTelSale" filterable :disabled="isDXZDisabled">
                            <el-option
                                v-for="item in orgTeleArr"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="电销顾问:">
                        <el-select
                            v-model="form.teleSaleId"
                            placeholder="电销顾问"
                            style="width: 100%;"
                            filterable
                            multiple
                            clearable  >
                            <el-option
                                v-for="item in busSaleArr"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id">
                                <el-checkbox-group v-model="form.teleSaleId">
                                    <el-checkbox :label="item.id">{{item.name}}</el-checkbox>
                                </el-checkbox-group>
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="搜索词:">
                        <el-input v-model="form.searchWord" placeholder="搜索词"></el-input>
                    </el-form-item>
                    <el-form-item label="最后拨打时间:">
                        <el-date-picker
                            v-model="form.telEndTimeStart"
                            type="datetime"
                            placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="—" class="widthauto">
                        <el-date-picker
                            v-model="form.telEndTimeEnd"
                            type="datetime"
                            placeholder="选择日期时间">
                        </el-date-picker>
                    </el-form-item>
                    <!--    <el-form-item label="">
                        <el-input v-model="form.address" placeholder="地址"></el-input>
                    </el-form-item> -->
                    <el-form-item label="资源类别:">
                        <el-select v-model="form.category" placeholder="资源类别" clearable>
                            <el-option
                                    v-for="item in categoryArr"
                                    :key="item.value"
                                    :label="item.name"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="媒介:">
                        <el-select v-model="form.medium" placeholder="媒介" clearable filterable>
                            <el-option
                                    v-for="item in mediumArry"
                                    :key="item.value"
                                    :label="item.name"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="QQ:">
                        <el-input v-model="form.qq" placeholder="QQ" maxLength="20" @keyup.native="number"></el-input>
                    </el-form-item>
                    <el-form-item label="微信:">
                        <el-input v-model="form.wechat" placeholder="微信"></el-input>
                    </el-form-item>
                    <el-form-item label="邮箱:">
                        <el-input v-model="form.email" placeholder="邮箱"></el-input>
                    </el-form-item>
                    <el-form-item label="资源是否有效:">
                        <el-select v-model="form.status" placeholder="资源是否有效" clearable >
                            <el-option
                                v-for="item in comArr"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否接通:">
                        <el-select v-model="form.isCall" placeholder="是否接通" clearable >
                            <el-option
                                v-for="item in comArr"
                                :key="item.value"
                                :label="item.name"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否签约:" prop="isSign">
                        <el-select v-model="form.isSign" clearable placeholder="是否签约"   :disabled="disabledIsSign">
                            <el-option v-for="item in isSignOptions" :key="item.value" :label="item.name"
                                       :value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否补齐尾款:">
                        <el-select v-model="form.isTailMoney" placeholder="是否补齐尾款" clearable  :disabled="disabledIsTailMoney">
                            <el-option v-for="item in isTailMoneyArr" :key="item.value" :label="item.label"
                                       :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="资源来源:">
	                    <el-select v-model="form.teleReceiveSource" clearable placeholder="资源来源">
	                        <el-option v-for="item in teleReceiveSourceArr" :key="item.value" :label="item.name"
	                                   :value="item.value"></el-option>
	                    </el-select>
	                </el-form-item>
                    <el-form-item label="是否话务转化:">
                        <el-select v-model="form.phtraConversion" placeholder="是否话务转化" clearable>
                            <el-option v-for="item in phtraConversionArr" :key="item.value" :label="item.label"
                                       :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="手机号归属地:">
                        <el-input v-model="form.phoneLocale" placeholder="手机号归属地" ></el-input>
                    </el-form-item>
                    <el-form-item label="未跟访时间(天):">
                        <el-input v-model="form.notFollowUpTime" placeholder="最长不允许超过三位数"   maxlength="3"  show-word-limit @keyup.native="number"></el-input>
                    </el-form-item>
                </el-row>
                <div class="mainSearchBtnBox">
                    <el-button type="primary" icon="el-icon-search" @click="initTableData" class="searchBtn">搜索</el-button>
                    <!-- <el-button type="info" class="searchBtn">取消</el-button> -->
                    <span style="color: #5c6be8;cursor: pointer;margin:0 10px;" @click="toogleClick"><span v-if="isShow">收起</span><span v-else>展开更多</span><i :class="{'greycolor paddingL6 el-icon-arrow-up':isShow,'greycolor paddingL6 el-icon-arrow-down':!isShow}"></i></span>
                </div>
            </el-form>
        </div>
        <el-row>
            <el-table  ref="multipleTable" tooltip-effect="dark" border @selection-change="handleSelectionChange" style="width: 100%"  :data="dataTable" @row-dblclick="showClueDetailInfo1" v-loading="loading">
                <el-table-column align="center" type="selection" label="全选" width="55"></el-table-column>
                <el-table-column align="center" type="index" label="序号" width="55"></el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-for="(item,key,index) in tableColums" v-if="item.fieldCode == 'cusName'">
                    <template slot-scope="scope">
                        {{scope.row.cusName}}
                        <span v-if="scope.row.inputType ==1">
                            <input type='hidden'><img th:src="@{/images/self_build.png}"  style="margin:0 10px;width:22px;cursor: pointer;vertical-align: middle;" alt="">
                        </span>
                        <span v-else-if="scope.row.phtraCustomerStatus ==4">
                            <input type='hidden'><img th:src="@{/images/fromTraffic.png}"  style="margin:0 10px;width:44px;cursor: pointer;vertical-align: middle;" alt="">
                        </span>
                    </template>
                </el-table-column>

                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'phone'">
                    <template slot-scope="scope" >
                        <span class="blueColorBtn" @click="showClueDetailInfo(scope.row.clueId)">{{scope.row.phone}}</span><span v-if="scope.row.phoneLocale != null && scope.row.phoneLocale != ''">（{{scope.row.phoneLocale}}）</span>

                        <input type='hidden'>
                        <img th:src="@{/images/tel.png}" :readonly="phoneDisabled" @click="gettelNumberIcon(scope.row.phone,scope.row.clueId)" style="margin:0 10px;width:22px;cursor: pointer;vertical-align: middle;" alt="">
                        <el-tag v-if="scope.row.tag">{{scope.row.tag}}</el-tag>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'phone2'">
                    <!--  <template slot-scope="scope">{{scope.row.phone}}<input type='hidden'><img th:src="@{/images/tel.png}" @click="customerEidt(scope.row.clueId)" style="margin:0 10px;width:22px;cursor: pointer;vertical-align: middle;" alt=""><el-tag v-if="scope.row.tag">{{scope.row.tag}}</el-tag></template> -->
                    <template slot-scope="scope">
                        {{scope.row.phone2}}<span v-if="scope.row.phone2Locale != null && scope.row.phone2Locale != ''">（{{scope.row.phone2Locale}}）</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'phone3'">
                    <!--  <template slot-scope="scope">{{scope.row.phone}}<input type='hidden'><img th:src="@{/images/tel.png}" @click="customerEidt(scope.row.clueId)" style="margin:0 10px;width:22px;cursor: pointer;vertical-align: middle;" alt=""><el-tag v-if="scope.row.tag">{{scope.row.tag}}</el-tag></template> -->
                    <template slot-scope="scope">
                        {{scope.row.phone3}}<span v-if="scope.row.phone3Locale != null && scope.row.phone3Locale != ''"> （{{scope.row.phone3Locale}}）</span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'customerStatusName'">
                    <template slot-scope="scope">
                        {{scope.row.customerStatusName}}
                        <div v-if="scope.row.signList.length >=1"  v-for="it in scope.row.signList">
                            <el-button size="mini"  v-if="it.refundStatus==4 || it.refundStatus==6" type="text"  style="color: blue" @click="toReadOnlySignPage(it,scope.row)">{{it.signNo}}<span  style="color: red" >(已退款)</span></el-button>
                            <el-button size="mini"  v-else-if="it.refundStatus!=4 && it.refundStatus !=6" type="text"  style="color: blue" @click="toReadOnlySignPage(it,scope.row)">{{it.signNo}}</el-button>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column :prop="item.fieldCode" :key="item.fieldCode" :label="item.displayName" :width="item.width" align="center" v-else-if="item.fieldCode == 'record'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.isTrack === 1" @mouseenter="openTrackingDialogByhover(scope.row.clueId)">
                            <el-popover
                                    title="跟进记录"
                                    placement="top"
                                    width="1002"
                                    :open-delay=500
                                    trigger="hover">
                                <el-table ref="singleTable" tooltip-effect="dark" style="width: 100%" border :data="recordTable">
                                    <el-table-column align="center" type="index" width="30" label="序号"></el-table-column>
                                    <el-table-column align="center" prop="callTime" width="170" label="跟进时间"></el-table-column>
                                    <el-table-column align="center" prop="customerStatusName" label="客户状态" width="90"></el-table-column>
                                    <el-table-column align="center" prop="isConnect" :formatter="formatIsCall" label="是否接通" width="100"></el-table-column>
                                    <el-table-column align="center" prop="callDetailsName" label="客户关注点" width="300">
                                        <template slot-scope="scope">
                                            {{scope.row.callDetailsName}}
                                            <span v-if="scope.row.callDetailsName != null && scope.row.callDetailsName != ''">
                                            -</span>{{scope.row.focusPoint}}
                                        </template>

                                    </el-table-column>
                                    <el-table-column align="center" prop="nextVisitTime" label="下次回访时间" width="170"></el-table-column>
                                    <el-table-column align="center" prop="createUserName" label="创建人" width="140"></el-table-column>
                                </el-table>
                                <el-button slot="reference" @click.stop="openTrackingDialog(scope.row.clueId)"  type="text" size="small"> 点击查看<span style="color:red;">({{scope.row.trackNum}})</span> </el-button>
                            </el-popover>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'sex'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.sex === 1">男</div>
                        <div v-else-if="scope.row.sex ===2">女</div>
                    </template>
                </el-table-column>
                <el-table-column :prop="item.fieldCode" :key="item.fieldCode" :label="item.displayName" :width="item.width" align="center" v-else-if="item.fieldCode == 'repeatPhones'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.isRepeatPhone===1">
                            <el-button @click="repeatPhonesClick(scope.row)" type="text" size="small">点击查看</el-button>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'assignTime'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2 || scope.row.teleReceiveSource == 5">
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'isCall'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.isCall == 0">否</div>
                        <div v-else-if="scope.row.isCall ==1">是</div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'status'">
                    <template slot-scope="scope">
                        <div v-if="scope.row.status == 0">否</div>
                        <div v-else-if="scope.row.status ==1">是</div>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'hasRepeatClue'">
                    <template slot-scope="scope">
                        <span v-if="scope.row.hasRepeatClue ==1">
                           <el-button @click="showHasRepeatClue(scope.row)" type="text" size="small">点击查看</el-button>
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'sourceName'">
                    <template slot-scope="scope">
                        <span v-if="telemarketingLayoutSourceIsShow(scope.row.category)">
                           {{scope.row.sourceName}}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"
                                 v-else-if="item.fieldCode == 'clueProjectName'">
                    <template slot-scope="scope">
                        <span v-if="telemarketingLayoutProjectIsShow(scope.row.category)">
                           {{scope.row.clueProjectName}}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column align="center" sortable  :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width" v-else-if="item.fieldCode == 'createTime'||item.fieldCode == 'updateTimeStr'||item.fieldCode == 'storeArea'"></el-table-column>
                <el-table-column align="center" :key="item.fieldCode" :prop="item.fieldCode" :label="item.displayName" :width="item.width"  v-else>
                </el-table-column>

            </el-table>
            <table-pagination v-if="paginationShow" :pager="pager" :papernum="papernum" @change="initTableData"></table-pagination>
        </el-row>
    </div>
    <!-- dialog -->
    <!-- 跟进记录 -->
    <el-dialog title="跟进记录" :visible.sync="recordDialog">
        <el-table
            ref="singleTable"
            tooltip-effect="dark"
            style="width: 100%"
            border
            :data="recordTable"
        >
            <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
            <el-table-column align="center" prop="callTime" label="跟进时间"></el-table-column>
            <el-table-column align="center" prop="status" label="客户状态"></el-table-column>
            <el-table-column align="center" prop="isConnect" label="是否接通"></el-table-column>
            <!--  <el-table-column align="center" prop="isNeedResource" label="资源有效性"></el-table-column> -->
            <el-table-column align="center" prop="isInvite" label="是否邀约"></el-table-column>
            <el-table-column align="center" prop="customerFocus" label="客户关注点"></el-table-column>
            <!--<el-table-column align="center" prop="isReturnVisit" label="是否继续回访"></el-table-column>  -->
            <el-table-column align="center" prop="nextTimeVisit" label="下次回访时间"></el-table-column>
            <el-table-column align="center" prop="createPerson" label="创建人"></el-table-column>
        </el-table>
    </el-dialog>
    <!-- 跟进记录 -->
    <el-dialog :title="'资源ID'+dailogTitleType+'重复手机号资源信息'" :visible.sync="repeatPhonesDialog" width="1000px">
        <div v-show="showPhoneTable">
            <p style="padding:10px 0;">手机号<span style="color: red">(1)</span>{{phone}}重复手机号资源</p>
            <el-table ref="singleTable" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable2">
            <p style="padding:10px 0;">手机号<span style="color: red">(2)</span>{{phone2}}重复手机号资源</p>
            <el-table ref="singleTable2" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable2">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable3">
            <p style="padding:10px 0;">手机号<span style="color: red">(3)</span>{{phone3}}重复手机号资源</p>
            <el-table ref="singleTable3" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable3">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable4">
            <p style="padding:10px 0;">手机号<span style="color: red">(4)</span>{{phone4}}重复手机号资源</p>
            <el-table ref="singleTable4" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable4">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
        <div v-show="showPhoneTable5">
            <p style="padding:10px 0;">手机号<span style="color: red">(5)</span>{{phone5}}重复手机号资源</p>
            <el-table ref="singleTable5" tooltip-effect="dark" style="width: 100%" border :data="repeatPhonesTable5">
                <el-table-column align="center" type="index" width="55" label="序号"></el-table-column>
                <el-table-column align="center" prop="createTime" label="资源创建时间" width="150">
                    <template slot-scope="scope">
                        <div v-if="scope.row.phase == 1 || scope.row.phase == 2">
                            <font color="red">「重话务」</font>{{scope.row.createTime}}
                        </div>
                        <div v-else>
                            {{scope.row.createTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="phoneChangeTime" label="联系方式创建时间" width="150"></el-table-column>
                <el-table-column align="center" prop="teleDirectorName" label="电销总监" width="130"></el-table-column>
                <el-table-column align="center" prop="teleSaleName" label="电销顾问" width="130"></el-table-column>
                <el-table-column align="center" prop="teleGorupName" label="电销组" width="130"></el-table-column>
                <el-table-column align="center" prop="teleReceiveTime" label="分配时间" width="170">
                    <template slot-scope="scope">
                        <div v-if="scope.row.teleReceiveSource == 1 || scope.row.teleReceiveSource == 2">
                            {{scope.row.teleReceiveTime}}(分配)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===3">
                            {{scope.row.teleReceiveTime}}(领取)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===4">
                            {{scope.row.teleReceiveTime}}(自建)
                        </div>
                        <div v-else-if="scope.row.teleReceiveSource ===5">
                            {{scope.row.teleReceiveTime}}(分发)
                        </div>
                        <div v-else>
                            {{scope.row.teleReceiveTime}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column align="center" prop="fowEndTime" label="最新跟进时间"></el-table-column>
                <el-table-column align="center" prop="teleProject" label="电销组负责项目"></el-table-column>
                <el-table-column align="center" prop="createUserRoleName" label="资源创建人角色" width="130"></el-table-column>
                <el-table-column align="center" prop="createUserName" label="资源创建人" width="110"></el-table-column>
            </el-table>
        </div>
    </el-dialog>
    <!-- 分配资源 -->
    <el-dialog title="分配资源" :visible.sync="allocateFormVisible" width="540px">
        <el-form :model="formAllocat" ref="formAllocat">
            <el-form-item
                label="电销顾问："
                prop="telSales"
                :rules="[
                    { required: true, message: '请选择活动区域电销顾问', trigger: 'change' }
                ]"
                :label-width="formLabelWidth">
                <el-select v-model="formAllocat.telSales" placeholder="请选择" style="width: 80%;">
                    <el-option
                        v-for="item in saleList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="客户级别："  prop="cusLevel"  :label-width="formLabelWidth">
                <el-select v-model="formAllocat.cusLevel" placeholder="不变化" style="width: 80%;">
                    <el-option
                        v-for="item in cusLevelArr"
                        :key="item.value"
                        :label="item.name"
                        :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer" style="text-align:center;">
            <el-button type="primary"
                       :disabled="btnDisabled" @click="submitAllocatForm('formAllocat')">提交</el-button>
            <el-button @click="resetForm('formAllocat');allocateFormVisible = false;">取 消</el-button>
        </div>
    </el-dialog>
    <!-- 转移资源 -->
    <el-dialog title="转移资源" :visible.sync="transferFormVisible" width="540px">
        <el-form :model="formTransfer" ref="formTransfer">
            <el-form-item
                label="电销总监："
                prop="salesDirector"
                :rules="[
                { required: true, message: '请选择活动区域电销总监', trigger: 'change' }
            ]"
                :label-width="formLabelWidth">
                <el-select v-model="formTransfer.salesDirector" placeholder="请选择" style="width: 80%;" filterable>
                    <el-option
                        v-for="item in saleGroupList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer" style="text-align:center;">
            <el-button type="primary" :disabled="btnDisabled" @click="submitTransferForm('formTransfer')">提交</el-button>
            <el-button @click="resetForm('formTransfer');transferFormVisible=false;">取 消</el-button>
        </div>
    </el-dialog>
    <!-- 批号分配 -->
    <el-dialog title="信息流批量分配" :visible.sync="batchFormVisible" width="540px">
        <el-form :model="formBatch" ref="formBatch">
            <el-form-item
                label="信息流分配规则："
                prop="batchRule"
                :rules="[
                { required: true, message: '请选择信息流分配规则', trigger: 'change' }
            ]"
                :label-width="formLabelWidth">
                <el-select v-model="formBatch.batchRule" placeholder="请选择" style="width: 60%;">
                    <el-option label="规则名称1" value="batchRule1"></el-option>
                    <el-option label="规则名称2" value="batchRule2"></el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer" style="text-align:center;">
            <el-button type="primary" @click="submitBatchForm('formBatch')">提交</el-button>
            <el-button @click="resetForm('formBatch');batchFormVisible=false;">取 消</el-button>
        </div>
    </el-dialog>
    <!-- 副总分发 -->
    <el-dialog title="副总分发" :visible.sync="vicemanagerFormVisible" width="540px">
        <el-form :model="formVicemanage" ref="formVicemanage">
            <el-form-item
                label="电销总监："
                prop="salesDirector"
                :rules="[
                { required: true, message: '请选择电销总监', trigger: 'change' }
            ]"
                :label-width="formLabelWidth">
                <el-select v-model="formVicemanage.salesDirector" placeholder="请选择" style="width: 80%;"@change="currentSalesDirector" >
                    <el-option
                        v-for="item in saleGroupList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item
                label="电销顾问："
                prop="salesstaff"
                :rules="[
                { required: true, message: '请选择电销顾问', trigger: 'change' }
            ]"
                :label-width="formLabelWidth">
                <el-select v-model="formVicemanage.salesstaff" placeholder="请选择" style="width: 80%;">
                    <el-option
                        v-for="item in saleInfoArr"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer" style="text-align:center;">
            <el-button type="primary" :disabled="btnDisabled" @click="submitVicemanagerForm('formVicemanage')">提交</el-button>
            <el-button @click="resetForm('formVicemanage');vicemanagerFormVisible=false;">取 消</el-button>
        </div>
    </el-dialog>
    <dialog-tracking :param="trackingParam"></dialog-tracking>
    <!-- 自定义列 -->
    <el-dialog title="自定义列" :visible.sync="dialogChooseList" class="elCheckboxGroup">
        <el-form :model="form1">
            <el-form-item label="" prop="type">
                <el-checkbox-group v-model="form1.type">
                    	<span>
                    	</span>
                    <el-checkbox :label="item.sortNum+'_'+item.fieldCode+'_'+item.displayName+'_'+item.id+'_'+item.width"   name="type" :key="item.fieldCode"  v-for="(item,index) in  allTableColums ">
                        {{item.displayName}}
                    </el-checkbox>

                </el-checkbox-group>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="confirmColumn">确 定</el-button>
            <el-button @click="dialogChooseList = false">取 消</el-button>
        </div>
    </el-dialog>
    <el-dialog title="重复资源信息" :visible.sync="dialogFormVisible1" width="870px">
        <el-form :model="dialogForm" ref="dialogForm" class="marginB10 dialogForm" v-for="item in repeatClueList" height="600">
            <div class="fs16 redcolor marginB20">重复时间：{{formatTimeFn(item.discoverTime)}}</div>
            <div class="borderbox padding10">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="客户姓名：" :label-width="formLabelWidth">{{item.clueDTO.clueCustomer.cusName}}</el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="手机号：" :label-width="formLabelWidth" >{{getPhones(item.clueDTO.clueCustomer)}}</el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="微信：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueCustomer.wechat}}<span @click="lookWechat(item.clueDTO.clueCustomer)" v-if="(item.clueDTO.clueCustomer.wechat2 !=null && item.clueDTO.clueCustomer.wechat2 !='')||(item.clueDTO.clueCustomer.wechatCode !=null && item.clueDTO.clueCustomer.wechatCode !='')" style="color: rgb(0, 114, 255); cursor: pointer;">查看更多</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="邮箱：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueCustomer.email}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="QQ：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueCustomer.qq}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="资源类型：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.typeName}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="留言时间：" :label-width="formLabelWidth">
                            {{formatTimeFn(item.clueDTO.clueBasic.messageTime)}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="资源类别：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.categoryName}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="搜索词：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.searchWord}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="留言重点：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.messagePoint}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="地域信息：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueIntention.address}}
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="备注：" :label-width="formLabelWidth">
                            {{item.clueDTO.clueBasic.remark}}
                        </el-form-item>
                    </el-col>
                </el-row>
                <div v-if="telemarketingLayout !=null && (','+telemarketingLayout.category+',').indexOf(','+item.clueDTO.clueBasic.category+',') != -1">
                    <el-row >
                        <el-col :span="12" v-if="telemarketingLayout.projectShow ==1">
                            <el-form-item label="资源项目：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueProject.projectName}}
                            </el-form-item>
                        </el-col>
                        <el-col :span="12" v-if="telemarketingLayout !=null && telemarketingLayout.sourceShow ==1">
                            <el-form-item label="媒介：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueBasic.sourceName}}
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" v-if="telemarketingLayout !=null && telemarketingLayout.adShow ==1">
                            <el-form-item label="广告文案：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueBasic.ad}}
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12" v-if="telemarketingLayout !=null && telemarketingLayout.urlShow ==1">
                            <el-form-item label="URL：" :label-width="formLabelWidth">
                                {{item.clueDTO.clueReceive.urlAddress}}
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>
            </div>
        </el-form>
    </el-dialog>

    <el-dialog title="查看微信/二维码" :visible.sync="repeatWechatVisible">
        <el-form :model="repeatWeDialogForm" ref="repeatWeDialogForm">
            <!--展示phone2  phone3  phone4 phone5-->
            <el-form-item  label="微信2：" :label-width="formLabelWidth"  >
                <el-button type="text" disabled>{{repeatCustomer.wechat2}}</el-button>
            </el-form-item>
            <el-form-item  label="图片二维码：" :label-width="formLabelWidth"  >
                <img v-show="repeatCustomer.wechatCode!=''"  :src="repeatCustomer.wechatCode">
            </el-form-item>
        </el-form>
    </el-dialog>
    </template>
</div>
</body>
<!-- import Vue before Element -->
<div th:include="_footer_include :: #jsLib"></div>
<script th:inline="javascript" >
  var orgList=[[${orgList}]];//电销组
  var saleList=[[${saleList}]];//电销顾问
  var saleGroupList=[[${saleGroupList}]];//同事业部下电销组
  var queryOrg=[[${queryOrg}]];//电销组
  var fieldList=[[${fieldList}]];//自定义字段
  var userFieldList=[[${userFieldList}]];//用户自定义字段
  var ownOrgId=[[${ownOrgId}]];//电销总监电销组
  var telemarketingLayout = [[${telemarketingLayout}]];
  //角色编码
  var roleCode = [[${roleCode}]];
  // var userFieldList=[];
  // 业务线(待分配新资源页面和客户管理页面允许外包业务线复制，外包业务线编码如下：1、5、6、10、11、12、13)
  var businessLine=[[${businessLine}]];
  var canCopy=[[${canCopy}]];
  var timer = null;
  var  customerManVM=new Vue({
    el: '#myCustom',
    data: function() {
      return {
        loading:false,
          //释放资源按钮
          releaseBtnDisabled:false,
          //是否签约默认可选
          disabledIsSign:false,
          //是否补齐尾款默认可选
          disabledIsTailMoney:false,
          mediumArry:[],
          telemarketingLayout:telemarketingLayout,
          dialogForm: {
              phoneNum: ''
          },
          repeatWeDialogForm:{},
          repeatWechatVisible:false,
          repeatCustomer:{},
          dialogFormVisible1:false,
          repeatClueList:[],
        paginationShow: false,//分页是否显示
        isShow:false,
        phoneDisabled:false,
        btnDisabled: false,
        recordDialog:false,
        dialogChooseList:false,
        repeatPhonesDialog:false,
        allocateFormVisible: false, //分配资源
        isDXZDisabled:false,
        dailogTitleType:'',
        formAllocat:{
          telSales:'',
          cusLevel:''
        },
        transferFormVisible: false, //转移资源
        formTransfer:{
          salesDirector:''
        },
        batchFormVisible: false, //批量分配
        formBatch: {
          batchRule: ''
        },
        vicemanagerFormVisible: false, //副总分发
        formVicemanage: {
          salesDirector: '',
          salesstaff: ''
        },
        pager:{
          total: 0,
          currentPage: 1,
          pageSize: 20,
        },
        papernum:[20, 50, 100,500],
        trackingParam:{
          trackingDialogVisible:false,
          tableData:[]
        },
        adviserValue: '', //电销顾问
        isTailMoneyArr: [{value: '', label: '全部'}, {value: '0', label: '否'}, {value: '1', label: '是'}],
        isSignOptions: [{
          value: 0,
          name: "未签约"
        }, {
          value: 1,
          name: "已签约"
        }],
        isTransfer:[
          {
            value: '0',
            label: '新资源' },
          {
            value: '1',
            label: '转来资源'
          }
        ],
        clueStatus:[
          {
            value: '1',
            label: '有效'
          },
          {
            value: '0',
            label: '无效'
          }
        ],
        callTel:[
          {
            value: '1',
            label: '是'
          },
          {
            value: '0',
            label: '否'
          }
        ],
        hasInvite:[
          {
            value: '0',
            label: '未邀约'
          },
          {
            value: '1',
            label: '已邀约'
          }
        ],
        clueRepeatStatus:[
          {
            value: '0',
            label: '否'
          },
          {
            value: '1',
            label: '是'
          }
        ],
        hastracking:[
          {
            value: '0',
            label: '未跟访'
          },
          {
            value: '1',
            label: '跟访'
          }
        ],
          phtraConversionArr: [{value: '', label: '全部'}, {value: '0', label: '否'}, {value: '1', label: '是'}],
        teleReceiveSourceArr:[
       	 {value:"1",name:"分配"},
            {value:"3",name:"领取"},
       	 {value:"4",name:"自建"},
            {value:"5",name:"分发"},
            {value:"6",name:"平台"},
            {value:"7",name:"自动分配"}
       ],
        form: {
            medium:'',
          teleReceiveSource:"",
          isTransfer:'',
          cluesta:'',
          customerPhone:'',
          customerName:'',
          cusStatus:'',
          cusLeve:'',
          updateTimeStart:'',
          updateTimeEnd:'',
          createTimeStart:'',
          createTimeEnd:'',
          assignTimeStart:'',
          assignTimeEnd:'',
          telEndTimeStart:'',
          telEndTimeEnd:'',
          dayTel:'',
          hasInvite:'',
          repeatStatus:'',
          province:'',
          category:'',
          category:'',
          searchWord:'',
          address:'',
          trackingDay:'',
          teleorg:ownOrgId,
          teleSaleId:'',
          clueId:'',
          qq:"",
          wechat:"",
          email:"",
          status:"",
          isCall:"",
          isTailMoney:"",
          isSign:0,
            phtraConversion:"",
            cusLevelList:[],
            phoneLocale:"",
            notFollowUpTime:""
        },
        form1: {
          type: [],
        },
        comArr:[
          {value:"",name:"全部"},
          {value:"1",name:"是"},
          {value:"0",name:"否"}
        ],
        cusLevelArr:[],
        categoryArr:[],
        provinceArr:[],
        repeatCurClueArr:[],
        cusStatusArr:[],
        telePerArr:[],
        orgTeleArr:queryOrg,
        multseleSelection:[],
        formLabelWidth: '150px',
        dataTable: [],
        saleInfoArr:[],
        busSaleArr:[],
        saleList:saleList,
        saleGroupList:saleGroupList,
        value: '',//下拉选项默认值
        recordTable:[],
        repeatPhonesTable:[],
        repeatPhonesTable2:[],
        repeatPhonesTable3:[],
        repeatPhonesTable4:[],
        repeatPhonesTable5:[],
        showPhoneTable:false,
        showPhoneTable2:false,
        showPhoneTable3:false,
        showPhoneTable4:false,
        showPhoneTable5:false,
        phone:'',
        phone2:'',
        phone3:'',
        phone4:'',
        phone5:'',
        dialogFormVisible: false,
        formList: {
          type: [],
        },
        allTableColums:[],
        tableColums:[],

        storeForm: {
          isTransfer:'',
          cluesta:'',
          customerPhone:'',
          customerName:'',
          cusStatus:'',
          cusLeve:'',
          updateTimeStart:'',
          updateTimeEnd:'',
          createTimeStart:'',
          createTimeEnd:'',
          assignTimeStart:'',
          assignTimeEnd:'',
          telEndTimeStart:'',
          telEndTimeEnd:'',
          dayTel:'',
          hasInvite:'',
          repeatStatus:'',
          province:'',
          category:'',
          category:'',
          searchWord:'',
          address:'',
          trackingDay:'',
          teleorg:ownOrgId,
          teleSaleId:'',
          clueId:'',
          qq:"",
          wechat:"",
          email:"",
          status:"",
          isCall:"",
        },
        storeId: '',
        scrollTop: 0,
      }
    },
    methods: {
        formatIsCall(row, column){
            //是否接通
            console.log(row)
            return row.isCall==0?"否": row.isCall==1?"接通/微信沟通":""
        },
    	async gettelNumberIcon(tel,clueId) {
    	  var isReturn =false;
      	await axios.post('/call/callRecord/missedCalPhone?phone='+tel, {})
          .then(function (response) {
          	if(response.data !=""){
          		customerManVM.$message({
                      message: response.data,
                      type: 'warning'
                  });
          		isReturn = true; ;
          	}
             ;
          });
      	if(isReturn){
      		return;
      	}
          this.phoneDisabled = true;
          var sessionStorage =window.sessionStorage;
          if(sessionStorage.getItem("phoneKey"+clueId) ==null || new Date().getTime()-sessionStorage.getItem("phoneKey"+clueId)>15000){
              sessionStorage.setItem("phoneKey"+clueId,new Date().getTime());
            //外呼手机
              var param = {};
              param.clueId = clueId;
              // 存储选中信息--start
              this.setSessionStore("telemarketingStoreForm", this.storeForm);
              var otherVal = {
                  "currentPage": this.pager.currentPage,
                  "clueId": clueId
              }

              this.setSessionStore("telemarketingOtherVal", otherVal);
              // 存储选中信息--end
              window.parent.parent.outboundCallPhone(tel, 2, clueId, function (res) {
                  axios.post('/tele/clueMyCustomerInfo/updateCallTime', param).then(function (response) {
                  });
              });
              //跳转页面
              this.showClueDetailInfo(clueId);
          }
      },
      //日期数据格式化方法
      dateFormat(row, column, cellValue, index) {
        if (cellValue == undefined) {
          return "";
        }
        return moment(cellValue).format("YYYY-MM");
      },
        //只输入正整数
        number() {
            var pattern = /^[1-9][0-9]*$/ // 正整数的正则表达式
            // 不符合正整数时
            if (!pattern.test(this.form.notFollowUpTime)) {
                // input 框绑定的内容为空
                this.form.notFollowUpTime = ''
            }
        },
      //初始化页面
      initTableData(){
        var param = {};
        var pageSize = this.pager.pageSize;
        var pageNum = this.pager.currentPage;
        // 存储
        localStorage.setItem('customManagementPageSize', pageSize);
        param.pageNum=pageNum;
        param.pageSize=pageSize;
        param.isTransfer=this.form.isTransfer;
        param. status=this.form.cluesta;
        param.phone=this.form.customerPhone ;
        param.cusName=this.form.customerName;
        param.customerStatus=this.form.cusStatus;
        param.cusLevel=this.form.cusLeve;
        param.updateTimeStart=this.form.updateTimeStart;
        param.updateTimeEnd=this.form.updateTimeEnd;
        param.createTimeStart=this.form.createTimeStart;
        param.createTimeEnd=this.form.createTimeEnd;
        param.assignTimeStart=this.form.assignTimeStart;
        param.assignTimeEnd=this.form.assignTimeEnd;
        param.telEndTimeStart=this.form.telEndTimeStart;
        param.telEndTimeEnd=this.form.telEndTimeEnd;
        param.isCall=this.form.isCall;
        param.status=this.form.status;
        param.dayTel=this.form.dayTel;
        param.hasInvite=this.form.hasInvite;
        param.repeatStatus=this.form.repeatStatus;
        if(null!=this.form.province&&this.form.province.length>0) {
            param.provinces= this.form.province.join(",");
        }
        param.category= this.form.category;
        param.address= this.form.address;
        param.searchWord= this.form.searchWord;
        param.trackingDay= this.form.trackingDay;
        param.teleorg= this.form.teleorg;
        param.clueId = this.form.clueId;
        param.qq = this.form.qq;
        param.email = this.form.email;
        param.wechat = this.form.wechat;
        param.isSign = this.form.isSign;
        param.isTailMoney = this.form.isTailMoney;
        param.teleReceiveSource = this.form.teleReceiveSource;
          param.phtraConversion = this.form.phtraConversion;
          param.phoneLocale = this.form.phoneLocale;
          param.cusLevels = this.form.cusLevelList;
          param.source=this.form.medium;
        if(null!=this.form.teleSaleId&&this.form.teleSaleId.length>0) {
          param.teleSaleId= this.form.teleSaleId.join(",");
        }
        if(this.form.updateTimeStart !=null && this.form.updateTimeStart != '' && this.form.updateTimeEnd !=null && this.form.updateTimeEnd != '' && this.form.updateTimeStart>this.form.updateTimeEnd){
          this.$message({
            message: '编辑开始时间不能大于结束时间',
            type: 'warning'
          });
          return;
        }
        if(this.form.createTimeStart !=null && this.form.createTimeStart != '' && this.form.createTimeEnd !=null && this.form.createTimeEnd != '' && this.form.createTimeStart>this.form.createTimeEnd){
          this.$message({
            message: '创建开始时间不能大于结束时间',
            type: 'warning'
          });
          return;
        }
        if(this.form.assignTimeStart !=null && this.form.assignTimeStart != '' && this.form.assignTimeEnd !=null && this.form.assignTimeEnd != '' && this.form.assignTimeStart>this.form.assignTimeEnd){
          this.$message({
            message: '分配开始时间不能大于结束时间',
            type: 'warning'
          });
          return;
        }
        if(this.form.telEndTimeStart !=null && this.form.telEndTimeStart != '' && this.form.telEndTimeEnd !=null && this.form.telEndTimeEnd != '' && this.form.telEndTimeStart>this.form.telEndTimeEnd){
          this.$message({
            message: '最后拨打开始时间不能大于结束时间',
            type: 'warning'
          });
          return;
        }
          param.notFollowUpTime = this.form.notFollowUpTime;
          this.loading=true;
        axios.post('/tele/customerManager/findcustomerManagerPage',param).then(function (response) {
          var resobj= response.data;
          var pageData=resobj.data;
          var data=pageData.data;
          for(var i=0;i<data.length;i++){
            data[i].urgentDate=customerManVM.dateFormat(null,null,data[i].urgentDate,null);
          }
          customerManVM.pager.total=pageData.total;
          customerManVM.pager.currentPage = pageData.currentPage;
          customerManVM.pager.pageSize = pageData.pageSize;
          customerManVM.dataTable =pageData.data;
          customerManVM.loading=false;

          // 取出存储的id
          if(!customerManVM.paginationShow){
            if(customerManVM.storeId){
              customerManVM.$nextTick(function(){
                var storage = [];
                customerManVM.dataTable.forEach(function(item, index){
                  if(item.clueId === customerManVM.storeId ){
                    storage.push(customerManVM.dataTable[index]);
                  }
                })
                customerManVM.toggleSelection(storage);
                customerManVM.$el.querySelector('.el-table__body-wrapper').scrollTop = customerManVM.scrollTop;
              })
            }
          }else{
            customerManVM.removeSessionStore ("telemarketingStoreForm");
            customerManVM.removeSessionStore ("telemarketingOtherVal");
          }
          customerManVM.paginationShow = true;
          customerManVM.storeForm = customerManVM.form;
        })

      },
      toggleSelection(rows) { // table select 默认选中fn
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row,true);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      toReadOnlySignPage(row,tele){  // 进入签约单明细
        var clueId=row.clueId;
        // 存储选中信息--start
        this.setSessionStore("telemarketingStoreForm", this.storeForm);
        var otherVal = {
          "currentPage": this.pager.currentPage,
          "clueId": clueId,
          "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
        }
        this.setSessionStore("telemarketingOtherVal", otherVal);
        // 存储选中信息--end
        window.location.href='/businesssign/myCustomSignRecordPage?clueId='+row.clueId+"&signId="+row.signId+"&readyOnly=1&createUser="+tele.teleSaleId+"&type=2";
      },
      currentTelSale(seleVal){
        if(null==seleVal||seleVal==""){
          return ;
        }
        param={};
        param.orgId=seleVal;
        param.roleCode="DXCYGW";
        param.statusList =[1,3];
        axios.post('/user/userManager/listByOrgAndRole' ,param).then(function (response) {
          customerManVM.busSaleArr=response.data.data;
        });
      },
      repeatPhonesClick(row) {
        console.log(row);
        this.repeatPhonesDialog=true;
        this.dailogTitleType=row.clueId;
        this.repeatPhonesTable=[];
        var param ={};
        param.id = row.clueId;
        param.clueId = row.clueId;
        param.cusPhone = row.phone;
        debugger
        axios.post('/clue/appiontment/repeatPhoneMap', param).then(function (response) {
          // var result =  response.data;
          // var table=result.data;
          // customerManVM.repeatPhonesTable=table;
          var map = response.data.data;
          if(map.phone){
            customerManVM.phone = map.phones[0]
            customerManVM.repeatPhonesTable=map.phone;
            customerManVM.showPhoneTable = true;
          }else{
            customerManVM.phone = '';
            customerManVM.repeatPhonesTable=[];
            customerManVM.showPhoneTable = false;
          }
          if(map.phone2){
            customerManVM.phone2 = map.phones[1]
            customerManVM.repeatPhonesTable2=map.phone2;
            customerManVM.showPhoneTable2 = true;
          }else{
            customerManVM.phone2 ='';
            customerManVM.repeatPhonesTable2=[];
            customerManVM.showPhoneTable2 = false;
          }
          if(map.phone3){
            customerManVM.phone3 = map.phones[2]
            customerManVM.repeatPhonesTable3=map.phone3;
            customerManVM.showPhoneTable3 = true;
          }else{
            customerManVM.phone3 = '';
            customerManVM.repeatPhonesTable3=[];
            customerManVM.showPhoneTable3 = false;
          }
          if(map.phone4){
            customerManVM.phone4 = map.phones[3]
            customerManVM.repeatPhonesTable4=map.phone4;
            customerManVM.showPhoneTable4 = true;
          }else{
            customerManVM.phone4 = ''
            customerManVM.repeatPhonesTable4=[];
            customerManVM.showPhoneTable4 = false;
          }
          if(map.phone5){
            customerManVM.phone5 = map.phones[4]
            customerManVM.repeatPhonesTable5=map.phone5;
            customerManVM.showPhoneTable5 = true;
          }else{
            customerManVM.phone5 = map.phones[4]
            customerManVM.repeatPhonesTable5=[];
            customerManVM.showPhoneTable5 = false;
          }
          customerManVM.repeatPhonesDialog=true;
        })  .catch(function (error) {
          console.log(error);
        });
      },
      openvicemanagerForm(){
        var rows = this.multseleSelection;
        if(rows.length <1){
          this.$message({
            message: '请选副总分发数据',
            type: 'warning'
          });
          return;
        }
        this.vicemanagerFormVisible=true;
        if(this.$refs['formVicemanage']) {
          this.$refs['formVicemanage'].resetFields();
        }
      },
      currentSalesDirector(selVal){
        param={};
        customerManVM.formVicemanage.salesstaff ='';
        var directorArr = selVal.split(",");
        param.orgId=directorArr[0];
        axios.post('/clue/pendingAllocation/getSaleList',param).then(function (response) {
          customerManVM.saleInfoArr=response.data.data;
        });
      },
      openassignrDig(){
        var rows = this.multseleSelection;
        if(rows.length <1){
          this.$message({
            message: '请选分配资源',
            type: 'warning'
          });
          return;
        }
        this.allocateFormVisible = true;
        if(this.$refs['formAllocat']) {
          this.$refs['formAllocat'].resetFields();
        }
      },
      opentransferForm(){
        var rows = this.multseleSelection;
        if(rows.length <1){
          this.$message({
            message: '请选择转移资源',
            type: 'warning'
          });
          return;
        }
        this.transferFormVisible = true;
        if(this.$refs['formTransfer']) {
          this.$refs['formTransfer'].resetFields();
        }
      },
      handleSelectionChange(val) {
        this.multseleSelection = val;
      },

      toogleClick(){
        if(this.isShow){
          this.isShow=false
        }else{
          this.isShow=true
        }
      },
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      recordClick(row) {
        console.log(row);
        this.recordDialog=true;
      },
      resetForm(formName) {
        // alert(1);
        this.$refs[formName].resetFields();
        // this.allocateFormVisible = false;
        // this.dialogFormTransferVisible = false;
      },
        submitAllocatForm(formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    var telSale = this.formAllocat.telSales;
                    var rows = this.multseleSelection;
                    var cusLevel = this.formAllocat.cusLevel;
                    var idArr = [];
                    for (var i = 0; i < rows.length; i++) {
                        idArr.push(rows[i].clueId);
                    }
                    var param = {};
                    param.idList = idArr;
                    param.teleSaleId = telSale;
                    param.cusLevel = cusLevel;
                    // this.allocateFormVisible = false;

                    this.btnDisabled = true;

                    // 判断选择几条
                    if (rows.length == 1) {
                        console.log(rows)
                        var name = rows[0].teleSaleName;
                        var time = rows[0].teleReceiveTime;
                        if (time == "" || time == null || time == undefined) {
                            time = rows[0].createTime;
                        }
                        /* if(name){
                        } */
                        this.$confirm('此资源已在' + time + '分配给顾问' + name + '。确认再次分配吗？', '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',
                            type: 'warning'
                        }).then(() => {
                            axios.post('/clue/pendingAllocation/allocationClue', param)
                                .then(function (response) {
                                    if (response.data.code == -1 || response.data.code == 21918) {
                                        customerManVM.$message.error(response.data.msg);
                                        customerManVM.btnDisabled = false;
                                        customerManVM.allocateFormVisible = false; //关闭弹窗
                                        customerManVM.initTableData();
                                    } else {
                                        customerManVM.$message({
                                            message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                                                customerManVM.allocateFormVisible = false; //关闭弹窗
                                                customerManVM.btnDisabled = false;
                                                customerManVM.initTableData();
                                            }
                                        });
                                    }
                                }).catch(function (error) {
                                console.log(error);
                                customerManVM.allocateFormVisible = false; //关闭弹窗
                                customerManVM.btnDisabled = false;
                            });
                        }).catch(() => {
                            this.$message({
                                type: 'info',
                                message: '已取消分配'
                            });
                            customerManVM.btnDisabled = false;
                        });

                    } else {
                        axios.post('/clue/pendingAllocation/allocationClue', param)
                            .then(function (response) {
                                if (response.data.code == -1 || response.data.code == 21918) {
                                    customerManVM.$message.error(response.data.msg);
                                    customerManVM.btnDisabled = false;
                                } else {
                                    customerManVM.$message({
                                        message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                                            customerManVM.allocateFormVisible = false;
                                            customerManVM.btnDisabled = false;
                                            customerManVM.initTableData();
                                        }
                                    });
                                }
                            }).catch(function (error) {
                            console.log(error);
                            customerManVM.allocateFormVisible = false;
                            customerManVM.btnDisabled = false;
                        });
                    }
                } else {
                    console.log('error submit!!');
                    return false;
                }
            });
        },
      openTrackingDialog(cid){
    	    debugger;
          timer = setTimeout(function(){
              var param = {};
              param.clueId = cid;
              axios.post('/aggregation/tracking/queryList', param)
                  .then(function (response) {
                      console.log(response.data)
                      if (response.data.code == 0) {
                          customerManVM.trackingParam.tableData = response.data.data
                          customerManVM.trackingParam.trackingDialogVisible = true;
                      } else {
                          customerManVM.$message.error(response.data.msg);
                      }
                  }).catch(function (error) {
                  console.log(error);
              });
          }, 500);

      },
        openTrackingDialogByhover(cid){
            var param = {};
            param.clueId = cid;
            axios.post('/aggregation/tracking/queryList', param)
                .then(function (response) {
                    if (response.data.code == 0) {
                        customerManVM.recordTable = response.data.data
                    } else {
                        customerManVM.$message.error(response.data.msg);
                    }
                }).catch(function (error) {
            });

        },
      hideTrackingDialog(){
            if(timer){
                clearTimeout(timer);
            }
      },
      submitTransferForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            var rows = this.multseleSelection;
            var salesDirector=this.formTransfer.salesDirector;
            var idArr=[];
            for(var i=0;i<rows.length;i++){
              idArr.push(rows[i].clueId);
            }
            var  param={};
            param.idList=idArr;
            var directorArr = salesDirector.split(",");
            param.teleGorupId=directorArr[0];
            param.teleDirectorId=directorArr[1];
            this.transferFormVisible = false;

            this.btnDisabled = true;

            axios.post('/tele/customerManager/transferClue', param)
            .then(function (response) {
              customerManVM.$message({message:'操作成功',type:'success',duration:2000,onClose:function(){
                  customerManVM.btnDisabled = false;
                  customerManVM.initTableData();
                }});
            }).catch(function (error) {
              console.log(error);
              customerManVM.btnDisabled = false;
            });
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      submitBatchForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      //展现详情
      showClueDetailInfo (clueId) {
        // 存储选中信息--start
        this.setSessionStore("telemarketingStoreForm", this.storeForm);
        var otherVal = {
          "currentPage": this.pager.currentPage,
          "clueId": clueId,
          "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
        }
        this.setSessionStore("telemarketingOtherVal", otherVal);
        // 存储选中信息--end
        window.location.href='/tele/clueMyCustomerInfo/customerEditInfo?clueId='+clueId+'&zjFalg=1';
      },
        //展现详情(总监编辑，其他角色查看)
      showClueDetailInfo1 (row, column) {
        var clueId=row.clueId;
          if (roleCode == "DXZJ") {
              this.showClueDetailInfo(clueId);
          } else {
              // 存储选中信息--start
              this.setSessionStore("telemarketingStoreForm", this.storeForm);
              var otherVal = {
                  "currentPage": this.pager.currentPage,
                  "clueId": clueId,
                  "scrollTop": this.$el.querySelector('.el-table__body-wrapper').scrollTop
              }
              this.setSessionStore("telemarketingOtherVal", otherVal);
              // 存储选中信息--end
              window.location.href = '/tele/clueMyCustomerInfo/customerInfoReadOnly?clueId=' + clueId;
          }
      },
      submitVicemanagerForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            var rows = this.multseleSelection;
            var saleId=this.formVicemanage.salesstaff;
            var salesDirector=this.formVicemanage.salesDirector
            var idArr=[];
            for(var i=0;i<rows.length;i++){
              idArr.push(rows[i].clueId);
            }
            var  param={};
            param.idList=idArr;
            var directorArr = salesDirector.split(",");
            param.teleGorupId=directorArr[0];
            param.teleDirectorId=directorArr[1];
            param.teleSaleId=saleId;
            this.vicemanagerFormVisible = false;

            this.btnDisabled = true;
              axios.post('/clue/pendingAllocation/ceoDistributionClue', param)
                  .then(function (response) {
                      var data = response.data;
                      if (data.code == '0') {
                          customerManVM.$message({
                              message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                                  customerManVM.btnDisabled = false;
                                  customerManVM.initTableData();
                              }
                          });
                      } else if (data.code == '21918') {
                          customerManVM.$message({
                              message: data.msg,
                              type: 'warning'
                          });
                          customerManVM.btnDisabled = false;
                          customerManVM.initTableData();
                      } else {
                          clueVM.$message({
                              message: "接口调用失败",
                              type: 'error'
                          });
                          customerManVM.btnDisabled = false;
                      }
                  }).catch(function (error) {
                  console.log(error);
                  customerManVM.btnDisabled = false;
              });
          } else {
              console.log('error submit!!');
              return false;
          }
        });
      },
      //处理用户选择的列
      confirmColumn(){
        // debugger;
        //处理用户选择的列
        var customerShowColun = [];
        var customerColumn = this.form1.type;
        if(customerColumn.length==0){
          this.$message({
            message: '请选择列',
            type: 'warning'
          });
          return;
        }
        this.dialogChooseList = false;
        customerColumn.sort(this.sortNumber);//对选择的列排序
        var idList=[];
        for(var i=0;i<customerColumn.length;i++){
          var curItem = customerColumn[i];
          var itemArr = curItem.split("_");
          var obj = {};
          obj.fieldCode=itemArr[1];
          obj.displayName=itemArr[2];
          obj.width=itemArr[4];
          customerShowColun.push(obj);
          idList.push(itemArr[3])
        }
        this.tableColums = customerShowColun;
        var param ={};
        param.fieldIdList = idList;
        param.menuCode = "customerManager";
        if(idList.length!=0){
          axios.post('/customfield/customField/saveUserField', param)
          .then(function (response) {
          }).catch(function (error) {
            console.log(error);
          });
        }
      },
      initColumn(){
        //初始化table 列 和 用户自定义列
        this.allTableColums = fieldList;
        if(userFieldList.length!=0){
          var type=[];
          for(var i=0;i<userFieldList.length;i++){
            type.push(userFieldList[i].sortNum+'_'+userFieldList[i].fieldCode+'_'+userFieldList[i].displayName+'_'+userFieldList[i].fieldId+'_'+userFieldList[i].width)
          }
          this.form1.type = type;
          this.confirmColumn();
        }else{
          var type=[];
          for(var i=0;i<fieldList.length;i++){
            type.push(fieldList[i].sortNum+'_'+fieldList[i].fieldCode+'_'+fieldList[i].displayName+'_'+fieldList[i].id+'_'+fieldList[i].width)
          }
          this.form1.type = type;
          this.confirmColumn();
        }

      },
      sortNumber(a,b) {
        //对数组中元素，按照数字 从小到大 排序
        return a.split("_")[0] - b.split("_")[0];
      },
      setSessionStore (name, content) {
        if (!name) return
        if (typeof content !== 'string') {
          content = JSON.stringify(content)
        }
        window.sessionStorage.setItem(name, content)
      },
      getSessionStore (name) {
        if (!name) return;
        var content = window.sessionStorage.getItem(name);
        if (typeof content == 'string') {
          content = JSON.parse(content)
        }
        return content;
      },
      removeSessionStore (name) {
        if (!name) return
        return window.sessionStorage.removeItem(name)
      },
        showHasRepeatClue(row){
            var param ={};
            param.clueId = row.clueId;
            this.repeatClueList=[];
            axios.post('/tele/clueMyCustomerInfo/getRepeatClueRecordDTOList', param).then(function (response) {
                customerManVM.repeatClueList = response.data.data;
                customerManVM.dialogFormVisible1 =true;
            })

        },
        formatTimeFn(date) {
            if (null == date) {
                return "";
            }
            var dateNew = new Date(date);
            var year = dateNew.getFullYear()
            var month = dateNew.getMonth() + 1
            var day = dateNew.getDate()
            var hour = dateNew.getHours()
            var minute = dateNew.getMinutes()
            var second = dateNew.getSeconds()
            return year + "-" + this.formatNumberFn(month) + "-" + this.formatNumberFn(day) + " " + this.formatNumberFn(hour) + ":" + this.formatNumberFn(minute) + ":" + this.formatNumberFn(second);
        },
        formatNumberFn(n) {
            n = n.toString()
            return n[1] ? n : '0' + n
        },
        getPhones(cus){
            var phones = '';
            phones = cus.phone;
            if(cus.phone2 != null && cus.phone2 != ''){
                if(phones != ''){
                    phones = phones +","+cus.phone2;
                }else {
                    phones = cus.phone2;
                }
            }
            if(cus.phone3 != null && cus.phone3 != ''){
                if(phones != ''){
                    phones = phones +","+cus.phone3;
                }else {
                    phones = cus.phone3;
                }
            }
            if(cus.phone4 != null && cus.phone4 != ''){
                if(phones != ''){
                    phones = phones +","+cus.phone4;
                }else {
                    phones = cus.phone4;
                }
            }
            if(cus.phone4 != null && cus.phone5 != ''){
                if(phones != ''){
                    phones = phones +","+cus.phone5;
                }else {
                    phones = cus.phone5;
                }
            }
            return phones;
        },
        lookWechat(val){
            customerManVM.repeatCustomer = {};
            customerManVM.repeatWechatVisible =true;
            customerManVM.repeatCustomer = val;
        },
        telemarketingLayoutProjectIsShow(category){
            if((telemarketingLayout &&  (','+telemarketingLayout.category+',').indexOf(','+category+',') != -1 && telemarketingLayout.projectShow ==1) || roleCode =="GLY"){
                return true;
            }
            return false;
        },
        telemarketingLayoutSourceIsShow(category){
            if((telemarketingLayout &&  (','+telemarketingLayout.category+',').indexOf(','+category+',') != -1 && telemarketingLayout.sourceShow ==1) || roleCode =="GLY"){
                return true;
            }
            return false;
        },
        releaseClue() {
            var rows =  this.multseleSelection;
            if (rows.length < 1) {
                if (rows.length != 1) {
                    this.$message({message: '请选择资源', type: 'warning'});
                    return;
                }
            }
            this.$confirm('是否确认释放以下'+rows.length+'条资源到公有池？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                customerManVM.releaseBtnDisabled = true;
                var ids = [];
                for (var i = 0; i < rows.length; i++) {
                    ids.push(rows[i].clueId);
                }
                var param = {};
                param.clueIds = ids;
                console.log(param);
                axios.post('/aggregation/publiccustomer/batchReleaseClue', param)
                    .then(function (response) {
                        var data = response.data;
                        if (data.code == '0') {
                            customerManVM.$message({
                                message: '操作成功', type: 'success', duration: 2000, onClose: function () {
                                    customerManVM.releaseBtnDisabled = false;
                                    customerManVM.initTableData();
                                }
                            });
                        }
                    });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消释放'
                });
            });
        },
    },
    mounted(){
      document.getElementById('myCustom').style.display = 'block';
    },
      created() {
          // window.sessionStorage.clear(); // 点击侧边栏-清除所有cookie
          // 进入页面判断有是否有存储值
          if (!this.paginationShow) {
              var storeVal = this.getSessionStore("telemarketingStoreForm");
              var otherVal = this.getSessionStore("telemarketingOtherVal");
              if (storeVal && otherVal) {
                  this.form = storeVal;
                  this.$set(this.pager, "currentPage", otherVal.currentPage);
                  this.storeId = otherVal.clueId;
                  this.scrollTop = otherVal.scrollTop;
              }
              // 取页数存储
              var localVal = localStorage.getItem('allChangePageSize') ? parseInt(localStorage.getItem('allChangePageSize')) : '';
              if (localVal) {
                  this.pager.pageSize = localVal;
              }
          }
          ;
          if (ownOrgId) {
              this.isDXZDisabled = true;
              param = {};
              param.orgId = ownOrgId;
              param.roleCode = "DXCYGW";
              param.statusList = [1, 3];
              axios.post('/user/userManager/listByOrgAndRole', param).then(function (response) {
                  customerManVM.busSaleArr = response.data.data;
              });
          }
          //电销总监电销组筛选按钮不可点击
          //项目专员进入初始化值
          if (roleCode == 'XMWY') {
              this.form.isSign = 1;
              this.disabledIsSign = true;
              this.form.isTailMoney = '1';
              this.disabledIsTailMoney = true;
          }
          //初始化数据列表
          this.initTableData();
          //客户状态
          var param = {};
          param.groupCode = "customerStatus";
          axios.post('/dictionary/DictionaryItem/dicItemsByGroupCode', param).then(function (response) {
              // customerManVM.cusStatusArr=response.data.data;
              var datas = response.data.data;
              var arr = []
              for (var i = 0; i < datas.length; i++) {
                  if (datas[i].name != '不跟进') {
                      arr.push(datas[i])
                  }
              }
              customerManVM.cusStatusArr = arr
          });
          param = {};
          param.groupCode = "customerLevel";
          axios.post('/dictionary/DictionaryItem/dicItemsByGroupCode', param).then(function (response) {
              customerManVM.cusLevelArr = response.data.data;
          });
          //初始资源类别数据
          param = {};
          param.groupCode = "clueCategory";
          axios.post('/dictionary/DictionaryItem/dicItemsByGroupCode', param).then(function (response) {
              customerManVM.categoryArr = response.data.data;
          });
          //初始化省份
          param = {};
          param.type = "0";
          axios.post('/area/sysregion/querySysRegionByParam', param).then(function (response) {
              customerManVM.provinceArr = response.data.data.data;
          });
          var param = {};
          param.groupCode = "medium";
          axios.post('/dictionary/DictionaryItem/dicItemsByGroupCode', param).then(function (response) {
              customerManVM.mediumArry = response.data.data;
          });
          this.initColumn();
          // 除1、5、6、10、11、12、13业务线之外不可复制
          // if(businessLine!=1&&businessLine!=5&&businessLine!=6&&businessLine!=10&&businessLine!=11&&businessLine!=12&&businessLine!=13){
          if (canCopy != true) {
              document.getElementsByTagName('body')[0].className = 'noCopy'; //设置为新的
          }

      }
  })
</script>
</html>